package ntu.sna;
import java.awt.Dimension;
import java.lang.Math.*;
import javax.swing.JFrame;

import org.apache.commons.collections15.Factory;

import edu.uci.ics.jung.algorithms.layout.*;
import edu.uci.ics.jung.graph.*;
import edu.uci.ics.jung.graph.util.EdgeType;
import edu.uci.ics.jung.visualization.BasicVisualizationServer;

public class BasicGraphCreation {
	public static void main(String[] args) {
	    Graph< Integer , String> g = new SparseMultigraph<Integer,String>();
	    g.addVertex((Integer)1);
	    g.addVertex((Integer)2); 
	    g.addVertex((Integer)3);
	    g.addEdge("Edge-A" , 1, 2);
	    g.addEdge("Edge-B" , 2, 3);
	    
	    System.out.println(g);
	    
	    Graph< Integer , String> g2 = new SparseMultigraph<Integer,String>();
	    g2.addVertex((Integer)1);
	    g2.addVertex((Integer)2); 
	    g2.addVertex((Integer)3);
	    g2.addEdge("Edge-A" , 1, 2);
	    g2.addEdge("Edge-B" , 2, 3,EdgeType.DIRECTED);
	    g2.addEdge("Edge-C" , 3, 2,EdgeType.DIRECTED);
	    g2.addEdge("Edge-P" , 2, 3);
	    
	    System.out.println(g2);
	       
	    /*
	    Layout<MyNode, MyLink> layout = new KKLayout<MyNode, MyLink>(g);
	    layout.setSize(new Dimension(300, 300)); 
	    BasicVisualizationServer<MyNode, MyLink> vv = new BasicVisualizationServer<MyNode, MyLink>(layout);
	    vv.setPreferredSize(new Dimension(350, 350)); // Set graph dimensions

	    JFrame frame = new JFrame("Circle Graph");
	    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	    frame.getContentPane().add(vv);
	    frame.pack();
	    frame.setVisible(true);
	    */
	    
	}
}
